package com.jjsj.mall.shop.service.impl;

import com.jjsj.mall.shop.entity.YoshopOrder;
import com.jjsj.mall.shop.mapper.YoshopOrderMapper;
import com.jjsj.mall.shop.service.IYoshopOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商品订单Service业务层处理
 *
 * @author www.joolun.com
 * @date 2022-10-24
 */
@Service
public class YoshopOrderServiceImpl implements IYoshopOrderService {
    @Autowired
    private YoshopOrderMapper yoshopOrderMapper;

    /**
     * 查询商品订单
     *
     * @param orderId 商品订单ID
     * @return 商品订单
     */
    @Override
    public YoshopOrder selectYoshopOrderById(String orderId) {
        return yoshopOrderMapper.selectYoshopOrderById(orderId);
    }

    /**
     * 查询商品订单列表
     *
     * @param yoshopOrder 商品订单
     * @return 商品订单
     */
    @Override
//    @DataSource(value = DataSourceType.SLAVE)
    public List<YoshopOrder> selectYoshopOrderList(YoshopOrder yoshopOrder) {
        return yoshopOrderMapper.selectYoshopOrderList(yoshopOrder);
    }

    /**
     * 新增商品订单
     *
     * @param yoshopOrder 商品订单
     * @return 结果
     */
    @Override
    public int insertYoshopOrder(YoshopOrder yoshopOrder) {
        return yoshopOrderMapper.insertYoshopOrder(yoshopOrder);
    }

    /**
     * 修改商品订单
     *
     * @param yoshopOrder 商品订单
     * @return 结果
     */
    @Override
    public int updateYoshopOrder(YoshopOrder yoshopOrder) {
        return yoshopOrderMapper.updateYoshopOrder(yoshopOrder);
    }

    /**
     * 批量删除商品订单
     *
     * @param orderIds 需要删除的商品订单ID
     * @return 结果
     */
    @Override
    public int deleteYoshopOrderByIds(String[] orderIds) {
        return yoshopOrderMapper.deleteYoshopOrderByIds(orderIds);
    }

    /**
     * 删除商品订单信息
     *
     * @param orderId 商品订单ID
     * @return 结果
     */
    @Override
    public int deleteYoshopOrderById(String orderId) {
        return yoshopOrderMapper.deleteYoshopOrderById(orderId);
    }
}
